package com.ll.listdemo;

import java.util.*;

/**
 * @author 刘龙
 * @version 1.0
 */
public class ListFor {
    public static void main(String[] args) {
        List list = new LinkedList();
        list.add("ll");
        list.add("ll2");
        list.add("ll3");
        list.add("ll4");

        // 迭代器
        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Object object = iterator.next();
            System.out.print(object + ", ");
        }

        System.out.println();

        // 增强for
        for (Object object : list) {
            System.out.print(object + ", ");
        }

        System.out.println();

        // 普通for
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + ", ");
        }

    }
}
